package com.inossem.warehousestorage_inossem.request.changeStorage;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.changeStorage.ChangeStorageSelectMaterielBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by leij on 2017/6/12.
 */

public class ChangeStorageSelectMaterielRequest extends Request {

    private static final String FACTORY_CODE = "factoryCode";

    private static final String INVENTORY_ADDRESS_CODE = "inventoryAddressCode";

    private static final String CONDITION = "mat_code";

    private static final String SPECIAL_INVENTORY_FLAG = "specialInventoryFlag";

    public static String request(Context context, String condition, String factoryCode, String inventoryAddressCode, String specialInventory, GsonBeanListener gsonBeanListener) {
        String tag;
        Map<String, String> params = new HashMap<>();
//        params.put(FACTORY_CODE, factoryCode);
//        params.put(INVENTORY_ADDRESS_CODE, inventoryAddressCode);
        params.put(CONDITION, condition);
//        params.put(SPECIAL_INVENTORY_FLAG, specialInventory);
        String url = RequestManage.getUrl(context,RequestConstant.URL_CHANGE_STORAGE_SELECT_MATERIEL + RequestManage.mapEncodeToParams(params));
        tag = RequestManage.getHttpsGetWithLoading(context, url, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                ChangeStorageSelectMaterielBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), ChangeStorageSelectMaterielBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }

}
